package cn.oracle;

import java.util.ArrayList;
import java.util.Collection;

public class ContainerTest {
	public static void main(String[] args) {
		Container container=new Container();
		System.out.println("测试isEmpty,size,add:");
		System.out.println(container.isEmpty());
		System.out.println(container.size());
		System.out.println(container.add("彭于晏"));
		System.out.println(container.add("吴彦祖"));
		System.out.println(container.add("陈冠希"));
		System.out.println(container.add("梁朝伟"));
		System.out.println(container.add("陈小春"));
		System.out.println(container.isEmpty());
		System.out.println(container.size());
		System.out.println(container.add("彭于晏"));
		System.out.println(container.add("邱淑贞"));
		System.out.println(container.add("朱茵"));
		System.out.println(container.add("张敏"));
		System.out.println(container.add("周星驰"));
		System.out.println(container.add("郭富城"));
		System.out.println("-----------------------------------");
		System.out.println("测试contains:");
		System.out.println(container.contains("刘德华"));
		System.out.println(container.contains("彭于晏"));
		Object[] object=container.toArray();
		for(Object a:object) {
			System.out.print(a+" ");
		}
		System.out.println();
		System.out.println("-----------------------------------");
		System.out.println("测试remove:");
		System.out.println(container.remove("彭于晏"));
		System.out.println(container.remove("张学友"));
		object=container.toArray();
		for(Object a:object) {
			System.out.print(a+" ");
		}
		Collection<String> first = new ArrayList<String>();
		first.add( "吴彦祖" );
		first.add( "陈冠希" );
		first.add( "梁朝伟" );
		System.out.println("-----------------------------------");
		System.out.println("测试containsAll:");
		System.out.println(container.containsAll(first));
		Collection<String> second = new ArrayList<String>();
		second.add( "彭于晏" );
		second.add( "周润发" );
		second.add( "刘德华" );
		System.out.println(container.containsAll(second));
		System.out.println("-----------------------------------");
		System.out.println("测试addAll:");
		container.addAll(second);
		object=container.toArray();
		for(Object a:object) {
			System.out.print(a+" ");
		}
		System.out.println("");
		Collection<String> third = new ArrayList<String>();
		third.add( "刘德华" );
		third.add( "陈冠希" );
		System.out.println("-----------------------------------");
		System.out.println("测试removeAll:");
		container.removeAll(third);
		object=container.toArray();
		for(Object a:object) {
			System.out.print(a+" ");
		}
		Collection<String> fourth = new ArrayList<String>();
		fourth.add( "吴彦祖" );
		fourth.add( "陈小春" );
		fourth.add( "周润发" );
		System.out.println();
		System.out.println("-----------------------------------");
		System.out.println("测试retainAll:");
		container.retainAll(fourth);
		object=container.toArray();
		for(Object a:object) {
			System.out.print(a+" ");
		}
		System.out.println();
		System.out.println("-----------------------------------");
		System.out.println("测试clear:");
		container.clear();
		object=container.toArray();
		for(Object a:object) {
			System.out.print(a+" ");
		}
	}
}
